ab6bd8ffe39fad9d55c2ffaf316a23c5c1bad1ce,src/test/java/fm/jiecao/lib/HashidsTest.java,HashidsTest,test_specifying_custom_hash_length,#,47

Before Change


    long num_to_hash = 1L;
    long[] res2;
    try {
      a = new Hashids("this is my salt", 8);
    } catch (Exception e) {
      e.printStackTrace();
    }
    res = a.encrypt(num_to_hash);
    Assert.assertEquals(res, expected);
    res2 = a.decrypt(expected);
    Assert.assertEquals(res2.length, 1);
    Assert.assertEquals(res2[0], num_to_hash);
  }

After Change


  public void test_specifying_custom_hash_length(){
    final String expected = "gB0NV05e";
    final long num_to_hash = 1L;
    final Hashids a = new Hashids("this is my salt", 8);

    final String res = a.encrypt(num_to_hash);
    Assert.assertEquals("encrypt", expected, res);

    final long[] res2 = a.decrypt(expected);
    Assert.assertArrayEquals("decrypt",new long[]{num_to_hash}, res2);
  }